//
//  IndicatorView.m
//  封装播放器
//
//  Created by douya on 15/1/21.
//  Copyright (c) 2015年 douya. All rights reserved.
//

#import "IndicatorView.h"

@implementation IndicatorView
@synthesize delegate;

-(id)initWithFrame:(CGRect)frame
{
    if ([super initWithFrame:frame])
    {
        self.imageView=[[UIImageView alloc] initWithFrame:CGRectMake(frame.size.width/2-7*frame.size.width/20, frame.size.height/2-8*frame.size.height/20, 7*frame.size.width/10, 7*frame.size.height/10)];
        self.imageView.backgroundColor=[UIColor clearColor];
        [self addSubview:self.imageView];
        
        self.button=[UIButton buttonWithType:UIButtonTypeRoundedRect];
        self.button.frame=CGRectMake(frame.size.width/2-7*frame.size.width/20, frame.size.height/2-8*frame.size.height/20, 7*frame.size.width/10, 7*frame.size.height/10);
        [self.button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:self.button];
        
        self.label=[[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMinX(self.imageView.frame), CGRectGetMaxY(self.imageView.frame), CGRectGetWidth(self.imageView.frame), frame.size.height-CGRectGetMaxY(self.imageView.frame))];
        self.label.textAlignment=NSTextAlignmentCenter;
        self.label.backgroundColor=[UIColor clearColor];
        self.label.textColor=[UIColor whiteColor];
        [self addSubview:self.label];
        
        
        
        
    }
    return self;
}

-(void)buttonClick
{
    if ([delegate respondsToSelector:@selector(IndicatorView:playOrpause:)])
    {
        [delegate IndicatorView:self playOrpause:YES];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
